/**
*      author: Y_Yao
*      created: 2025-05-22 11:38:49
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
int n,k;
int a[N];

void solve()
{
    cin >> n >> k;
    int mi = LLINF;
    int mx = 0;
    int sum = 0;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        sum += a[i];
        mi = min(mi,a[i]);
        mx = max(mx,a[i]);
    }
    int cnt = 0;
    for(int i = 1;i <= n;i++)
    {
        if(a[i] == mx) cnt++;
    }

    if(mx - mi - 1 > k || (mx - mi - 1 == k && cnt > 1))
    {
        cout << "Jerry" << endl;
        return;
    }


    if(sum % 2 == 0)
    {
        cout << "Jerry" << endl;
        return;
    }
    cout << "Tom" << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}